package cm.day10;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class Test4 {
    public static void main(String[] args) throws IOException {
        List<Student> stuList = new ArrayList<>();
        stuList.add(new Student("张三", "男", "20", "88"));
        stuList.add(new Student("李四", "女", "19", "99"));
        for (Student student : stuList) {
            BufferedWriter bw = new BufferedWriter(new FileWriter("student.txt",true));
            bw.write(student.getName() + "  " + student.getSex() + "  " + student.getAge() + "  " + student.getScore());
            bw.newLine();
            bw.close();
        }
    }
}
